package com.qf.zhijia.service.impl;

import com.qf.zhijia.mapper.ItemMapper;
import com.qf.zhijia.mapper.UserMapper;
import com.qf.zhijia.pojo.Item;
import com.qf.zhijia.pojo.User;
import com.qf.zhijia.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Canaan
 * @version V1.0
 * @data 2020/09/05
 **/
@Service
public class ItemServiceImpl implements ItemService {
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private ItemMapper itemMapper;
    @Override
    public List<Item> findAll(Integer state, String phone) {
        User user = userMapper.selectByPhone(phone);
        List<Item> list = itemMapper.selectByuId(state,user.getUId());
        return list;
    }

    @Override
    public Integer update(Item item) {
        return itemMapper.updateByState(item);
    }

}
